package com.orangelife.mobile.individual.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.curry.orangelife.mobile.R;
import com.orangelife.mobile.app.application.ExitApplication;
import com.orangelife.mobile.common.activity.OrangeLifeBaseActivity;
import com.orangelife.mobile.util.EditTextInputUtil;
import com.orangelife.mobile.util.ToastHelper;
/**
 * 余额充值
 * @author Administrator
 *
 */
public class BalanceRechargeActivity extends OrangeLifeBaseActivity {
   private TextView tvTitle;
   private EditText etBalance;
   @Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_balance_recharge);
		initView();
	}
	private void initView() {
		etBalance = (EditText)findViewById(R.id.etBalance);
		tvTitle = (TextView)findViewById(R.id.tv_title);
		tvTitle.setText(getResources().getString(R.string.balance_recharge));
		EditTextInputUtil.setPricePoint(etBalance);
	}
	
	public void next(View v){
		if(!EditTextInputUtil.isLegalMoney(etBalance)){
			ToastHelper.getInstance()._toast("输入金额格式不正确");
		}else{
			Bundle bundle = new Bundle();
			bundle.putString("money",etBalance.getText().toString());
			Intent intent = new Intent(this,BalanceRechargeMethodActivity.class);
			intent.putExtras(bundle);
			startActivityForResult(intent, 1);
			ExitApplication.getInstance().addMainActivity(BalanceRechargeActivity.this);
		}
	}
	
	@Override
		protected void onActivityResult(int requestCode, int resultCode, Intent data) {
			super.onActivityResult(requestCode, resultCode, data);
			if(resultCode==RESULT_OK){
				setResult(resultCode);
				finish();
			}
		}
}
